window.onload=function()
{
    //var oDiv=document.getElementById("www_ablanuxe_com_1");//////获得拖拽的小格子
    //var oDiv2=document.getElementById("ablanuxe_com_2");///获得整个被作用拖拽的大盒子
    //var zhezhao=document.getElementById("www_ablanuxe_com");////
    //var h2=oDiv2.getElementsByTagName("h2")[0];
    //var right=document.getElementById("right");////拉伸右面方向
    //var bottom=document.getElementById("bottom");///拉伸底部方向
    //var mouseStart={};
    //var divStart={};
    //var rightStart={};
    //var bottomStart={};

    var oDiv=$("._notice8 .dragBlock");//////获得所有拖拽的方块
    console.log(oDiv);
    var oDiv2=document.getElementsByClassName("_notice8");///获得整个被作用拖拽的大盒子
    //var zhezhao=document.getElementById("www_ablanuxe_com");////
    //var h2=oDiv2.getElementsByTagName("h2")[0];
    //var right=document.getElementById("right");////拉伸右面方向
    //var bottom=document.getElementById("bottom");///拉伸底部方向
    var mouseStart={};/////鼠标按下的起点坐标
    var divStart={};
    var rightStart={};
    var bottomStart={};
    //往右拽
    //right.onmousedown=function(ev){
    //    var oEvent=ev||event;
    //    mouseStart.x=oEvent.clientX;
    //    mouseStart.y=oEvent.clientY;
    //    rightStart.x=right.offsetLeft;
    //    if(right.setCapture)
    //    {
    //        right.onmousemove=doDrag1;
    //        right.onmouseup=stopDrag1;
    //        right.setCapture();
    //    }
    //    else
    //    {
    //        document.addEventListener("mousemove",rightDrag,true);
    //        document.addEventListener("mouseup",stopRightDrag,true);
    //    }
    //};
    //往右面拖拽
    function rightDrag(ev){
        var oEvent=ev||event;
        var l=oEvent.clientX-mouseStart.x+rightStart.x;
        var w=l+oDiv.offsetWidth;
        if(w<oDiv.offsetWidth)
        {
            w=oDiv.offsetWidth;
        }
        else if(w>document.documentElement.clientWidth-oDiv2.offsetLeft)
        {
            w=document.documentElement.clientWidth-oDiv2.offsetLeft-2;
        }
        oDiv2.style.width=w+"px";
    };
    function stopRightDrag() {
        if(right.releaseCapture)
        {
            right.onmousemove=null;
            right.onmouseup=null;
            right.releaseCapture();
        }
        else
        {
            document.removeEventListener("mousemove",doDrag1,true);
            document.removeEventListener("mouseup",stopDrag1,true);
        }
    };
    //往下拽
    //bottom.onmousedown=function(ev){
    //    var oEvent=ev||event;
    //    mouseStart.x=oEvent.clientX;
    //    mouseStart.y=oEvent.clientY;
    //    bottomStart.y=bottom.offsetTop;
    //    if(bottom.setCapture)
    //    {
    //        bottom.onmousemove=doDrag2;
    //        bottom.onmouseup=stopDrag2;
    //        bottom.setCapture();
    //    }
    //    else
    //    {
    //        document.addEventListener("mousemove",bottomDrag,true);
    //        document.addEventListener("mouseup",stopBottomDrag,true);
    //    }
    //};
    //往下面拖拽
    function bottomDrag(ev){
        var oEvent=ev||event;
        var t=oEvent.clientY-mouseStart.y+bottomStart.y;
        var h=t+oDiv.offsetHeight;
        if(h<oDiv.offsetHeight)
        {
            h=oDiv.offsetHeight;
        }
        else if(h>document.documentElement.clientHeight-oDiv2.offsetTop)
        {
            h=document.documentElement.clientHeight-oDiv2.offsetTop-2;
        }
        oDiv2.style.height=h+"px";
    };
    function stopBottomDrag(){
        if(bottom.releaseCapture)
        {
            bottom.onmousemove=null;
            bottom.onmouseup=null;
            bottom.releaseCapture();
        }
        else
        {
            document.removeEventListener("mousemove",doDrag2,true);
            document.removeEventListener("mouseup",stopDrag2,true);
        }
    };
    //往左右同时拽
    oDiv.onmousedown=function(ev){
        console.log(123);
        var oEvent=ev||event;
        mouseStart.x=oEvent.clientX;
        mouseStart.y=oEvent.clientY;
        divStart.x=oDiv.offsetLeft;
        divStart.y=oDiv.offsetTop;
        if(oDiv.setCapture)
        {
            oDiv.onmousemove=doDrag;
            oDiv.onmouseup=stopDrag;
            oDiv.setCapture();
        }
        else
        {
            document.addEventListener("mousemove",allDrag,true);
            document.addEventListener("mouseup",stopAllDrag,true);
        }
        //zhezhao.style.display='block';
    };
    //var oDiv;
    //$(".dragBlock").mousedown(function(ev){
    //    console.log(123);
    //    var oEvent=ev||event;
    //    mouseStart.x=oEvent.clientX;
    //    mouseStart.y=oEvent.clientY;
    //    divStart.x=oDiv.offsetLeft;
    //    divStart.y=oDiv.offsetTop;
    //    oDiv=$(this);
    //    if(oDiv.setCapture)
    //    {
    //        oDiv.onmousemove=doDrag;
    //        oDiv.onmouseup=stopDrag;
    //        oDiv.setCapture();
    //    }
    //    else
    //    {
    //        document.addEventListener("mousemove",allDrag,true);
    //        document.addEventListener("mouseup",stopAllDrag,true);
    //    }
    //    zhezhao.style.display='block';
    //
    //});
    //往左右同时拖拽
    function allDrag(ev){
        console.log(444);
        var oEvent=ev||event;
        var l=oEvent.clientX-mouseStart.x+divStart.x;
        var t=oEvent.clientY-mouseStart.y+divStart.y;
        var w=l+oDiv.offsetWidth;
        var h=t+oDiv.offsetHeight;
        if(w<oDiv.offsetWidth)
        {
            w=oDiv.offsetWidth;
        }
        else if(w>document.documentElement.clientWidth-oDiv2.offsetLeft)
        {
            w=document.documentElement.clientWidth-oDiv2.offsetLeft-2;
        }
        if(h<oDiv.offsetHeight)
        {
            h=oDiv.offsetHeight;
        }
        else if(h>document.documentElement.clientHeight-oDiv2.offsetTop)
        {
            h=document.documentElement.clientHeight-oDiv2.offsetTop-2;
        }
        oDiv2.style.width=w+"px";
        oDiv2.style.height=h+"px";
    };
    function stopAllDrag(){
        if(oDiv.releaseCapture)
        {
            oDiv.onmousemove=null;
            oDiv.onmouseup=null;
            oDiv.releaseCapture();
        }
        else
        {
            document.removeEventListener("mousemove",doDrag,true);
            document.removeEventListener("mouseup",stopDrag,true);
        }
        zhezhao.style.display='none';
    };

};